<?php

//var_dump ($_GET);
$username = $_GET['username'];
$thedirection = $_GET['direction'];
$groupId = $_GET['groupId'];

		require_once( "../config/config.php" );
		require_once( "../db/dbconnect.class.php" );
		require_once( "../db/dbGroup.class.php" );
		$DB = new DbGroup();
		
		if($thedirection == 'in'){
		
		$sql = "INSERT INTO `users_group` VALUES ('', ".$groupId.", '".$username."' );";
		$result = $DB->selectQuery($sql);
		
		}else{
		
		$sql = "DELETE FROM `users_group` WHERE `userId` =  '".$username."';";
		$result = $DB->selectQuery($sql);
		
		
		}
		
		
		



?>